/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "ticket_forma_pago")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TicketFormaPago.findAll", query = "SELECT t FROM TicketFormaPago t"),
    @NamedQuery(name = "TicketFormaPago.findByIdTicketFormaPago", query = "SELECT t FROM TicketFormaPago t WHERE t.idTicketFormaPago = :idTicketFormaPago"),
    @NamedQuery(name = "TicketFormaPago.findByCantidad", query = "SELECT t FROM TicketFormaPago t WHERE t.cantidad = :cantidad")})
public class TicketFormaPago implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_TICKET_FORMA_PAGO")
    private Integer idTicketFormaPago;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "CANTIDAD")
    private BigDecimal cantidad;
    @JoinColumn(name = "FORMA_PAGO", referencedColumnName = "ID_FORMA_PAGO")
    @ManyToOne(optional = false)
    private FormaPago formaPago;
    @JoinColumn(name = "TICKET", referencedColumnName = "ID_TICKET")
    @ManyToOne(optional = false)
    private Ticket ticket;

    public TicketFormaPago() {
    }

    public TicketFormaPago(Integer idTicketFormaPago) {
        this.idTicketFormaPago = idTicketFormaPago;
    }

    public TicketFormaPago(Integer idTicketFormaPago, BigDecimal cantidad) {
        this.idTicketFormaPago = idTicketFormaPago;
        this.cantidad = cantidad;
    }

    public Integer getIdTicketFormaPago() {
        return idTicketFormaPago;
    }

    public void setIdTicketFormaPago(Integer idTicketFormaPago) {
        this.idTicketFormaPago = idTicketFormaPago;
    }

    public BigDecimal getCantidad() {
        return cantidad;
    }

    public void setCantidad(BigDecimal cantidad) {
        this.cantidad = cantidad;
    }

    public FormaPago getFormaPago() {
        return formaPago;
    }

    public void setFormaPago(FormaPago formaPago) {
        this.formaPago = formaPago;
    }

    public Ticket getTicket() {
        return ticket;
    }

    public void setTicket(Ticket ticket) {
        this.ticket = ticket;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTicketFormaPago != null ? idTicketFormaPago.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TicketFormaPago)) {
            return false;
        }
        TicketFormaPago other = (TicketFormaPago) object;
        if ((this.idTicketFormaPago == null && other.idTicketFormaPago != null) || (this.idTicketFormaPago != null && !this.idTicketFormaPago.equals(other.idTicketFormaPago))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.TicketFormaPago[ idTicketFormaPago=" + idTicketFormaPago + " ]";
    }
    
}
